package com.mg.pluginwebservice.entity;

public class ParamNode {
    private String code;
    private String name;
    private double left;
    private double bottom;
    private double right;
    private double top;
    private String location;
    private String shpName1;
    private String shpName2;
    private String shpName3;

    public ParamNode(String code, String name, String location, String shpName1, String shpName2, String shpName3) {
        String[] loc = location.split(" ");
        this.code = code;
        this.name = name;
        this.left = Double.parseDouble(loc[0]);
        this.bottom = Double.parseDouble(loc[1]);
        this.right = Double.parseDouble(loc[2]);
        this.top = Double.parseDouble(loc[3]);
        this.location = location;
        this.shpName1 = shpName1;
        this.shpName2 = shpName2;
        this.shpName3 = shpName3;
    }

    public String getCode() {
        return code;
    }

    public void setCode(String code) {
        this.code = code;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public double getLeft() {
        return left;
    }

    public void setLeft(double left) {
        this.left = left;
    }

    public double getBottom() {
        return bottom;
    }

    public void setBottom(double bottom) {
        this.bottom = bottom;
    }

    public double getRight() {
        return right;
    }

    public void setRight(double right) {
        this.right = right;
    }

    public double getTop() {
        return top;
    }

    public void setTop(double top) {
        this.top = top;
    }

    public String getLocation() {
        return location;
    }

    public void setLocation(String location) {
        this.location = location;
    }

    public String getShpName1() {
        return shpName1;
    }

    public void setShpName1(String shpName1) {
        this.shpName1 = shpName1;
    }

    public String getShpName2() {
        return shpName2;
    }

    public void setShpName2(String shpName2) {
        this.shpName2 = shpName2;
    }

    public String getShpName3() {
        return shpName3;
    }

    public void setShpName3(String shpName3) {
        this.shpName3 = shpName3;
    }

    public String assistXmlData(String tmp) {
        boolean flag = false;
        if (tmp.contains("$shaName1")) {
            System.out.println(tmp);
            flag = true;
        }
        tmp = tmp.replace("$shaName1", this.shpName1);
        tmp = tmp.replace("$shaName2", this.shpName2);
        tmp = tmp.replace("$shaName3", this.shpName3);
        tmp = tmp.replace("$left", this.left + "");
        tmp = tmp.replace("$bottom", this.bottom + "");
        tmp = tmp.replace("$right", this.right + "");
        tmp = tmp.replace("$top", this.top + "");

        if (flag) {
            System.out.println(this.toString());
            System.out.println(tmp);
        }
        return tmp + "\r\n";
    }

    @Override
    public String toString() {
        return "ParamNode{" +
                "code='" + code + '\'' +
                ", name='" + name + '\'' +
                ", left=" + left +
                ", bottom=" + bottom +
                ", right=" + right +
                ", top=" + top +
                ", location='" + location + '\'' +
                ", shpName1='" + shpName1 + '\'' +
                ", shpName2='" + shpName2 + '\'' +
                ", shpName3='" + shpName3 + '\'' +
                '}';
    }
}
